<if condition="empty($binding_mobile)">
     <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/lrstyle.css"  rel="stylesheet">

<style>
.layui-layer-demo-wx{background: #fff !important;box-shadow: none !important;border-radius: 0px !important;}
</style>
<div class="shares_binding_wx" style="display:none;">
 <header id="binding_header" class="u-header clearfix">
        <div class="u-hd-left f-left">
            <!-- <a href="javascript:history.go(-1);" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a> -->
        </div>
        <div class="u-hd-tit"><span >{$webseting.web_title}-<font class="binding_header">绑定</font></span></div>
        <div class="rightBox">
           <!--  <a id="register_btn" href="{:U('Wap/Login/index')}" class="right rbtn">
               登陆
           </a> -->
        </div>
    </header>
 <form action="" role="form" id="binding_form" novalidate="novalidate" method="post" onSubmit="return false;">
    <div class="con_box show">
        <div class="step_1">
            <div class="form_box">
                 <div class="form_item" style="display:none;">
                    <!-- <label class="icon-cell_phone" for="code"></label> -->
                    <label><img src="__PUBLIC__/wap/img/recommend.png" /></label>
                    <div class="input_box">
                        <input class="text_box text_border" type="text" name="binding_code" id="binding_code"  value="{$_SESSION['share']}" placeholder="请输入推荐人手机号码/推荐码" maxlength="11">
                    </div>
                </div>
                <div class="form_item">
                    <!-- <label class="icon-cell_phone" for="mobile"></label> -->
                    <label><img src="__PUBLIC__/wap/img/phon.png" /></label>
                    <div class="input_box">
                        <input class="text_box text_border" type="tel" name="binding_mobile" id="binding_mobile" placeholder="请输入手机号码" maxlength="11">
                    </div>
                </div>
               <!--  <div class="form_item">
                  <label class="icon-mail" for="verify_code"></label>
                  <label><img src="__PUBLIC__/wap/img/syzm.png" /></label>
                   <div class="input_box">
                       <input class="text_verification text_border" type="text" name="binding_verify_code" id="binding_verify_code" placeholder="请输入验证码" maxlength="4">
                       <img  class="pic_verification verify_refresh" alt="" width="50" height="22" src="{:U('Wap/Login/verify')}">
                       <span class="icon_refresh icon-refresh"></span>
                   </div>
               </div> -->
            </div>
          <!--   <div class="error_tips"><span class="icon-warning icon_warning"></span>&nbsp;请输入校验码</div> -->

           <!--  <div class="btn_box">
               <a href="javascript: void(0);" class="btn phone_reg_btn disable">注册</a>
           </div> -->
        </div>
        <div class="step_2">
            <div class="form_box">
                <div class="form_item">
                    <!-- <label class="icon-cell_phone" for="mobile_code"></label> -->
                   <label><img src="__PUBLIC__/wap/img/yzm.png" /></label>
                    <div class="input_box">
                        <input class="text_message text_border" type="text" name="binding_mobile_code" id="binding_mobile_code" placeholder="请输入验证码" maxlength="6">
                        <a href="javascript:;" class="again_message  binding_send_sms">
                            <span class="text binding_get_sms">获取验证码</span>
                            <span class="binding_countdown" style="display:none;">（<em class="binding_num">60</em>S）</span>
                        </a>
                    </div>
                </div>

                <div class="form_item  binding_set_pwd">
                    <!-- <label class="icon-password" for="mem_password"></label> -->
                    <label><img src="__PUBLIC__/wap/img/ls.png" /></label>
                    <div class="input_box">
                        <input class="text_pwd text_border" type="password" name="binding_mem_password" id="binding_mem_password"  placeholder="输入密码(6-20位字母，数字或符号组合)" maxlength="20">
                    </div>
                </div>
                <div class="form_item binding_set_pwd">
                    <!-- <label class="icon-password" for="rep_password"></label> -->
                    <label><img src="__PUBLIC__/wap/img/ls.png" /></label>
                    <div class="input_box">
                        <input class="text_pwd text_border" type="password" name="binding_rep_password" id="binding_rep_password"  placeholder="重复密码" maxlength="20">
                    </div>
                </div>
            </div>
            <!-- <div class="error_tips">
                <span class="icon-warning icon_warning"></span>
                验证码错误
            </div> -->
             <input type="hidden" name="is_binding" id="is_binding" value="0">
            <div class="agreement">
                <label><input type="checkbox" name="fuwu" id="fuwu" value="1" checked>点击绑定，表示您同意FG峰购</label>
                <a href="{:U('wap/Login/fuwu')}" class="license-terms">《用户协议》</a>
            </div>
            <div class="btn_box" >
                <a href="javascript: void(0);" class="btn phone_binding_btn">绑定</a>
            </div>
             <div class="btn_box" >
                <a href="javascript: void(0);" class="btn layui-layer-close layui-layer-close2" style="background-color: #ccc;position:static;">稍后绑定</a>
            </div>
        </div>
    </div>
</form>
</div>
 <script type="text/javascript">
    $(function(){
  //捕获页 自动弹窗
   $.ajax({
        url: "{:U('wap/login/get_check_binding')}",
        type:'get',
        data:{binding_is_check:binding_is_check,binding_page:binding_page},
        dataType: 'json',
        success: function(data){
          if(data.status==1){
             get_binding()
          }else if(data.status==2){
              $('.shares_binding_wx').hide();
          }else{
            $('.shares_binding_wx').hide();
          }
        }
       });

    });
    </script>


    <script type="text/javascript">

 $('.verify_refresh').click(function(){
    //重载验证码
    var time = new Date().getTime();
    var src='{:U('Wap/Login/verify')}?'+time;
        $(this).attr('src',src);
 });
    </script>

  <script type="text/javascript">
function get_binding(){
  // var h = $(window).height();//获取页面的高度

  layer.open({
    type: 1,
    shade: 0.8,//透明度
    title: false, //不显示标题
    skin: 'layui-layer-demo-wx', //样式类名
    closeBtn: false,//关闭按钮
    shadeClose: true, //开启遮罩关闭
    area: ['100%', "100%"],
    scrollbar: false,//浏览器滚动锁定
    content: $('.shares_binding_wx'), //捕获的元素
    cancel: function(index){

        layer.close(index);
        this.content.show();
        $('.shares_binding_wx').hide();
        //layer.msg('捕获就是从页面已经存在的元素上，包裹layer的结构',{time: 5000});
    }
});
}
</script>
      <script>
jQuery(document).ready(function() {

                //FormValidator.init();

jQuery.validator.addMethod("binding_pwd_required", function(value) {
    var is_binding=$("#is_binding").val();
    var ret=true;
    if(is_binding=='0'){
      if(value){

      }else{
         ret=false;
      }
    }
  return ret;
});
jQuery.validator.addMethod("binding_pwd_rangelength", function(value) {
    var is_binding=$("#is_binding").val();
    var ret=true;
    if(is_binding=='0'){
      if(value){
         var leng=value.length;
          if(leng<6 || leng>20){
             ret=false;
          }
      }else{
         ret=false;
      }
    }
  return ret;
});
jQuery.validator.addMethod("binding_rep_required", function(value) {
    var is_binding=$("#is_binding").val();
    var ret=true;
    if(is_binding=='0'){
      if(value){

      }else{
         ret=false;
      }
    }
  return ret;
});
jQuery.validator.addMethod("binding_rep_rangelength", function(value) {
    var is_binding=$("#is_binding").val();
    var ret=true;
    if(is_binding=='0'){
      if(value){
         var leng=value.length;
          if(leng<6 || leng>20){
             ret=false;
          }
      }else{
         ret=false;
      }
    }
  return ret;
});
jQuery.validator.addMethod("binding_rep_equalTo", function(value) {
  var binding_mem_password=$("#binding_mem_password").val();
    var is_binding=$("#is_binding").val();
    var ret=true;
    if(is_binding=='0'){
      if(value==binding_mem_password){

      }else{
         ret=false;
      }
    }
  return ret;
});


$("#binding_form").validate({
  rules: {
    binding_mobile: {
    required:true,
    number:true,
    minlength:11,
    remote: {
            url: "{:U('Wap/Login/cheack_binding_mobile')}",
            type: "get",
            dataType: "json",
            data: {
                mobile: function () {
                    return $("#binding_mobile").val();　　　　//这个是取要验证的数据
                }
            },
            dataFilter: function (msg) {　　　　//判断控制器返回的内容
               $('#is_binding').val(msg);
                //0  未注册 1 已注册
                if(msg=='0'){//填写密码
                  $('.binding_set_pwd').show();
                }else{
                  $('.binding_set_pwd').hide();
                }
                 return true;
            }
        }
   },
   binding_mobile_code: {
    required:true,
    remote: {
            url: "{:U('Wap/Login/check_send_reg')}",
            type: "get",
            dataType: "json",
            data: {
                mobile: function () {
                    return $("#binding_mobile").val();　　　　//这个是取要验证的数据
                },
                mobile_code: function () {
                    return $("#binding_mobile_code").val();　　　　//这个是取要验证的数据
                }
            },
            dataFilter: function (msg) {　　　　//判断控制器返回的内容
                if (msg == "1") {
                    return true;
                }else {
                    return false;
                }
            }
        }
   },
   binding_mem_password: {
                    binding_pwd_required: true,
                    binding_pwd_rangelength: true,
                },
    binding_rep_password: {
        binding_rep_required: true,
        binding_rep_rangelength: true,
        binding_rep_equalTo: true
    },
    fuwu:'required'
  },
  messages: {
       binding_mobile:{
        binding_pwd_required:'<span class="icon-warning icon_warning"></span>&nbsp;请输入手机号码',
        number:'<span class="icon-warning icon_warning"></span>&nbsp;请输入正确的手机号码',
        minlength:'<span class="icon-warning icon_warning"></span>&nbsp;请输入正确的手机号码',
        remote:'<span class="icon-warning icon_warning"></span>&nbsp;手机号码已注册'
       },
       binding_mobile_code: {
        required:'<span class="icon-warning icon_warning"></span>&nbsp;请输入手机验证码',
        remote:'<span class="icon-warning icon_warning"></span>&nbsp;手机验证码不正确'
       },
       binding_mem_password: {
        binding_pwd_required:'<span class="icon-warning icon_warning"></span>&nbsp;请输入密码',
        binding_pwd_rangelength:'<span class="icon-warning icon_warning"></span>&nbsp;密码请保持6-20位'
       },
       binding_rep_password: {
        binding_rep_required:'<span class="icon-warning icon_warning"></span>&nbsp;请输入重复密码',
        binding_rep_rangelength:'<span class="icon-warning icon_warning"></span>&nbsp;重复密码请保持6-20位',
        binding_rep_equalTo:'<span class="icon-warning icon_warning"></span>&nbsp;两次密码输入不一致'
       },
       fuwu:'<span class="icon-warning icon_warning"></span>&nbsp;不同意服务协议不能绑定'
  },
   focusInvalid:false,
  success: function(label) { 
            // set  as text for IE 
           // alert('ok'); 
            //label.html(" ").addClass("checked"); 
        }, 
        /*执行ajaxsubmit  */ 
        submitHandler: function(editform) {

            var options = { 
                url :  "<?php echo U('Wap/Login/binding'); ?>", 
                type : "post" , 
                dataType:'json', 
                target : "#loader", 
                error: function(){layer.msg("服务器没有返回数据，可能服务器忙，请重试",{icon:5});}, 
                onwait : "正在处理信息，请稍候...",
                success: function(response){ 
                      // console.log(response);
                    //$("#loader").fadeIn(500).html(response.data).fadeOut(500); 
                    //$('#editform').hide(2000); 
                    if(response.status==1){
                        //alert("注册成功");
                        layer.msg('绑定成功', {icon: 6},function(){
                      //关闭后的操作
                      window.location.href="<?php echo U('Wap/Member/index'); ?>";
                      });
                    }else{
                        layer.msg(response.error, {icon: 5});
                       // alert(response.error);
                    }
                }
            };
            setTimeout((function(opt){
                return function(){
                    $('#binding_form').ajaxSubmit(opt);
                }
            })(options), 300); 
            return false; 
        }

  });



$('.phone_binding_btn').click(function(){
    $('#binding_form').submit();
});

$('.binding_send_sms').click(function(){
    var is_send=$(this).hasClass('disable');
    if(is_send){
      return false;
    }else{
        //短信发送
         $.ajax({
            url: "{:U('Wap/Login/binding_send_sms')}",
            type: "get",
            dataType: "json",
            data: {
                mobile: function () {
                    return $("#binding_mobile").val();　　　　//这个是取要验证的数据
                }
            },
            success: function (msg) {　　　　//判断控制器返回的内容
                if (msg.status == "1") {
                     //disable
                    // $('#mobile_code').val(msg.code);
                   // alert("验证码发送成功");
                    layer.msg('验证码发送成功', {icon: 6});
                     run_time_out();
                }else {
                   // alert(msg.msg);
                   layer.msg(msg.msg, {icon: 5});
                }
            }
       });
    }
});

});
function run_time_out(){
    var num=$('.binding_num').html();
    num=parseInt(num);
    var is_send=$('.binding_send_sms').hasClass('disable');
    if(num>0){
        $('.binding_get_sms').hide();
        $('.binding_countdown').show();
         $('.binding_send_sms').css('cssText','background-color: #eee;color: #666;-webkit-appearance: none;');
        num--;
        $('.binding_num').html(num);//显示倒计时
        if(!is_send){
          $('.binding_send_sms').addClass('disable');///禁止点击
        }
    }else{
       $('.binding_countdown').hide();
       $('.binding_get_sms').show();
       $('.binding_num').html(60);//初始化倒计时
       $('.binding_send_sms').removeClass('disable');///可以点击
        $('.binding_send_sms').removeAttr('style');
      return false;
    }
    setTimeout('run_time_out()',1000);
}
        </script>
</if>
   <script type="text/javascript">
    $(function(){
      $('.binding_phone_close').click(function(){
        $('.binding_phone_head_all').hide();
      });

      $('.binding_phone_go').click(function(){
         get_binding()
      });

       $('.is_guanzhu_close').click(function(){
        $('.is_guanzhu_all').remove();
      });
        set_scroll()

    });
    $(window).scroll(function () {
        set_scroll()
    });
       function set_scroll(){
           if ($(window).scrollTop() > 5) {
               $(".is_guanzhu_all").css('cssText', 'position:fixed;top:0;z-index:999;');
               ;
           }
           else {
               $(".is_guanzhu_all").css('cssText', '');
               ;
           }
       }
    </script>

